package com.springboot.test.common.exception;

import com.springboot.test.common.enums.ErrorCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

/**
 * 自定义异常类
 */
@Getter
public class BizException extends RuntimeException{
    private Integer code;
    private String msg;
    public BizException(Integer code,String message){
        this.code = code;
        this.msg = message;
    }
    public BizException(String message){
        this.code=ErrorCode.ERROR.getCode();
        this.msg=message;
    }

    public BizException(ErrorCode errorCode){
        this.code = errorCode.getCode();
        this.msg = errorCode.getMessage();
    }

}
